//
//  UIView+LG.m
//  微博
//
//  Created by apple on 15/8/25.
//  Copyright (c) 2015年 wyzc. All rights reserved.
//

#import "UIView+LG.h"
@implementation UIView (LG)
-(void)setCenterx:(CGFloat)centerx
{
    CGPoint center = self.center;
    center.x = centerx;
    self.center = center;
}
-(CGFloat)centerx
{
    return self.center.x;
}
-(void)setCentery:(CGFloat)centery
{
    CGPoint center = self.center;
    center.y = centery;
    self.center = center;
}
-(CGFloat)centery
{
    return self.center.y;
}

-(void)setX:(CGFloat)x
{
    CGRect frame = self.frame;
    frame.origin.x = x;
    self.frame = frame;
    
}
-(CGFloat)x{
    return self.frame.origin.x;
}
-(void)setY:(CGFloat)y
{
    CGRect frame = self.frame;
    frame.origin.y=y;
    self.frame = frame;
}
-(CGFloat)y{

    return self.origin.y;
}
-(void)setSize:(CGSize)size
{
    CGRect frame = self.frame;
    frame.size = size;
    self.frame = frame;
}
-(CGSize)size
{
    return self.frame.size;
}
-(void)setOrigin:(CGPoint)origin

{
    CGRect frame = self.frame;
    frame.origin = origin;
    self.frame = frame;
}
-(CGPoint)origin
{
    return  self.frame.origin;
}
-(void)setWidth:(CGFloat)width
{
    CGRect frame = self.frame;
    frame.size.width = width;
    self.frame = frame;
}
-(CGFloat)width
{
    return self.frame.size.width;
}
-(void)setHeight:(CGFloat)height
{
    CGRect frame = self.frame;
    frame.size.height = height;
    self.frame = frame;
}
-(CGFloat)height
{
    return  self.frame.size.height;
}

-(float)rightMarginWithView:(UIView *)view width:(float)width margin:(float)margin
{
    self.width = width;
    self.x = view.x - width - margin;
    return self.x;
}

-(float)bottomMarginWithView:(UIView *)view height:(float)height margin:(float)margin;
{
    self.height = height;
    self.y = view.y - height - margin;
    return self.y;
}

-(float)equalBottomWithView:(UIView *)view height:(float)height
{
    self.height = height;
    self.y = view.y+height+(view.height - self.height);
    return self.y;
}

@end
